<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<title>Insert title here</title>
</head>

<script type="text/javascript" language="javascript">
function addForm()
{
	var addForm = "<div id=\"add\">" +
		"<form name=\"addForm\" method=\"get\" action=\"AddHouse\">"+
	"<table summary=\"House\">"+
	"<tr><td>Areal (m^2): </td><td>"+
	"<input type=\"text\" id=\"areal\" name=\"areal\">"+
	"</td>"+
	"</tr>"+
	"<tr>"+
	"<td>Wall height:</td>"+
	"<td>"+
	"<input type=\"text\" id=\"wallHeight\" name=\"wallheight\">"+
	"</td>"+
	"</tr>"+
	"<tr>"+
	"<td>Population:</td>"+
	"<td>"+
	"<input type=\"text\" id=\"population\" name=\"population\">"+
	"</td>"+
	"</tr>"+
	"<tr>"+
	"<td>"+
	"<select id=\"buildingtypes\" name=\"buildingtypes\">"+
	"<option value=\"1\">Detached home</option>      "+
	"<option value=\"2\">Terraced home</option>"+
	"<option value=\"3\">Detached terraced home</option>"+
	"<option value=\"4\">Supermarked</option>"+
	"<option value=\"5\">School</option>"+
	"</select>"+
	"</td>"+
	"</tr>"+
	"<tr>"+
	"<td>"+
	"<input type=\"button\" value=\"submit\" onclick=\"send()\">"+
	"</td>"+
	"</tr>"+
	"</table>"+
	"</form>"+
	"</div>";
	$("#add").replaceWith(addForm);
}

function send() 
{
	var area = document.getElementById('areal').value;
	var people = document.getElementById('population').value;
	var wallHeight = document.getElementById('wallHeight').value;
	var directivID = document.getElementById('byggeforeskrift').value;
	var typeID = document.getElementById('buildingtypes').value;
	$.get('NewHouse',{area: area, people: people, wallHeight: wallHeight, dID: directivID, tID: typeID}, function(responseText)
			{
				$("#add").replaceWith(responseText);
			}	
	);
	
}


</script>
<%@ include file="CheckLogin.jsp" %>


<div id="header-buttons">
<input type="button" value="Menu" onclick="location.href='Menu.jsp'"/>
<input type="reset" value="Default"><br>
<div class="run"><input type="Submit" value="Run" ></div>
</div>
<div id="buttons">
<input type="button" value="add" onclick="addForm()">
</div>


<div id="add"></div>

</body>
</html>